package com.itheima.staticblock;

public class Test {

    public static void main(String[] args) {
        Demo.school="传智播客";
        System.out.println(Demo.school);
        Demo demo = new Demo();
        Demo demo2 = new Demo("鹿晗",28);
    }
}

class Demo{
    private String name;
    private int  age;
     static String school;

    {//构造代码块
        System.out.println("我是构造代码块中的内容");

    }
    static{
        System.out.println("我是静态代码块中的内容");
        //school="黑马程序员";
    }

    public Demo() {
    }

    public Demo(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
